package top.lt.lt_ssm.controller;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import top.lt.lt_ssm.bean.evaluate;
import top.lt.lt_ssm.service.EvaluateService;
import top.lt.lt_ssm.util.SimpleResult;
/*             evaluate              	*/
@Controller
@RequestMapping("/msg/leave/")
public class LeaveMsgController {
	@Resource
	private EvaluateService evaluateService;
	
	@RequestMapping("/Getin1/{in1}")
	public @ResponseBody SimpleResult Getin1(@PathVariable("in1") int eid) {
		evaluate getEvaluateBy = evaluateService.GetEvaluateBy(eid);
		System.out.println(getEvaluateBy);
		List<evaluate>e = new ArrayList<>();
		e.add(getEvaluateBy);
		return new SimpleResult(true,e);
	}
	@RequestMapping("/Getin2/{in2}")
	public @ResponseBody SimpleResult Getin2(@PathVariable("in2") String nikename) {
		List<evaluate> mh = evaluateService.Mh(nikename);
		mh.forEach(s->{
			System.out.println(s);
		});
		return new SimpleResult(mh);
	}
	@RequestMapping("/Getin3/{in3}")
	public @ResponseBody SimpleResult Getin3(@PathVariable("in3") int price) {
		List<evaluate> dx = evaluateService.Dx(price);
		dx.forEach(s->{
			System.out.println(s);
		});
		return new SimpleResult(dx);
	}
	@RequestMapping("/GetAll")
	public @ResponseBody SimpleResult GetAll() {
		List<evaluate> gma = evaluateService.GetEvaluateAll();
		gma.forEach(s->{
			System.out.println(s);
		});
		return new SimpleResult(gma);
	}
	
	@RequestMapping("/del/{eid}")
	public @ResponseBody SimpleResult del(@PathVariable("eid") int eid){
		int delByid = evaluateService.DelByid(eid);
		return new SimpleResult(delByid>0?true:false);
	}
	@RequestMapping("/list")
	public String leaveMsgList() {
		return "message/leaveMsg_list";
	}
}
